package com.usian.controller;

import com.usian.pojo.User;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("findById/{id}")
    public User findById(@PathVariable int id){
        System.out.println("id=======>"+id);
        return userService.findById(id);
    }
    /*通过？传参
    * */
    @RequestMapping("findById")
    public User findByIds(@RequestParam int id){
        System.out.println("id=======>"+id);
        return userService.findById(id);

    }
    @RequestMapping("findByConsumer2")
    public User findByConsumer2(@RequestBody User user){
        System.out.println("id=======>"+user);
        return userService.findById(user.getId());
    }
}
